@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
<div class="bg-white">
    <header class="mui-bar mui-bar-nav head-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href='@Url.Action("Index")'></a>
        <h1 class="mui-title">修改密码</h1>
    </header>
    <!--DOM -->
    <div class="mui-content bg-white">
        <!---->
        <br />
        <br />
        <div class="mui-content-padded login-form-box password-form-box" style="width: 90%;">
            <div class="mui-input-row">
                <input type="password" class="mui-input-clear j-old" placeholder="输入当前密码" />
            </div>
            <div class="mui-input-row">
                <input type="password" class="mui-input-clear j-pwd" placeholder="输入新密码" />
            </div>
            <div class="mui-input-row">
                <input type="password" class="mui-input-clear j-pwd2" placeholder="再次输入新密码" />
            </div>
        </div>
        <br /><br />

        <!---->
        <button class="mui-btn mui-btn-block mui-btn-green res-btn">保存</button>

        <br />
        <!---->
    </div>
</div>

@section Scripts{

<script>
	$(".res-btn").click(function () {
		if ($(".j-old").val().length<6||$(".j-pwd").val().length<6||$(".j-pwd2").val().length<6) {
			layerm.open({
			content: '密码长度要在6位以上'
			,btn: '确定'
			});
			return false;
		}
		
		if ($(".j-pwd").val()!=$(".j-pwd2").val()) {
			layerm.open({
			content: '两次密码不同，请重新输入'
			,btn: '确定'
			});
			return false;
		}
		
		$.ajax({
			type:"post",
			url:'@Url.Action("EditPwd")',
			data:{pwd:$(".j-pwd").val(),oldPwd:$(".j-old").val()},
			success:function (result) {
				if (result.state=="ok") {
					layerm.open({
					content: result.msg
					,btn: '确定',
					yes:function () {
						location.href='@Url.Action("Index","MyInfo")';
					}
					});
					
				}else if(result.state=="login"){
					location.href='@Url.Action("Index","Login")';
				}else{
					layerm.open({
					content: result.msg
					,btn: '确定',
					yes:function () {
						location.href='@Url.Action("Index","MyInfo")';
					}
					});
				}
			}
		})
		
	})
	
</script>

}